﻿#include<iostream>
#include<queue>
using namespace std;
const int N = 1e5 + 10;
int n;
int h[N], ne[N * 2], e[N * 2], id;
bool st[N];
void add(int a, int b)
{
	id++;
	e[id] = b;
	ne[id] = h[a];
	h[a] = id;
}
void bfs()
{
	queue<int> q;
	q.push(1);
	st[1] = true;

	while (q.size())
	{
		auto u = q.front(); q.pop();
		cout << u << " ";
		for (int i = h[u]; i; i = ne[i])
		{
			int v = e[i];
			if (!st[v])
			{
				q.push(v);
				st[v] = true;
			}
		}
	}
}
int main()
{
	cin >> n;
	for (int i = 1; i < n; i++)
	{
		int a, b; cin >> a >> b;
		add(a, b); add(b, a);
	}
	bfs();
	return 0;
}
//#include<iostream>
//#include<vector>
//#include<queue>
//using namespace std;
//const int N = 1e5 + 10;
//int n;
//vector<int> edges[N];//edges[i]保存着i号结点相连的所有点  
//bool st[N];//标记哪些点已经入过队了
//void bfs()
//{
//    queue<int>q;
//    q.push(1);
//    st[1] = true;
//    while (q.size())
//    {
//        int u = q.front(); q.pop();
//        cout << u << " ";
//        //让孩子入队  
//        for (auto v : edges[u])
//        {
//            if (!st[v])
//            {
//                q.push(v);
//                st[v] = true;
//            }
//        }
//    }
//}
////⽤vector数组
//int main()
//{
//    cin >> n;
//    for (int i = 1; i < n; i++)
//    {
//        int a, b; cin >> a >> b;//  读入1条边  
//        edges[a].push_back(b);
//        edges[b].push_back(a);
//    }
//    bfs();
//    return 0;
//}
////#define _CRT_SECURE_NO_WARNINGS 1
////#include<iostream>
////#include<vector>
////using namespace std;
////const int N = 1e5 + 10;
////int n;
////vector<int> edges[N];//edge[i]保存着i号节点相连的所有点
////bool st[N];//标记当前节点是否已经被遍历过
////void dfs1(int u)
////{
////	// 先访问该点
////	cout << u << " ";
////	st[u] = true; // 标记该点已经被访问过
////	// 访问它的⼦树
////	for (auto v : edges[u])
////	{
////		if (!st[v]) dfs1(v); // 如果没有遍历过，再去遍历
////	}
////}
//////⽤vector数组
////int main()
////{
////	cin >> n;
////	for (int i = 1; i <= n - 1; i++)
////	{
////		int a, b; cin >> a >> b; // 读⼊⼀条边
////		edges[a].push_back(b); // 保存a->b的⼀条边
////		edges[b].push_back(a); // 保存b->a的⼀条边
////	}
////	dfs1(1);
////}
//////#define _CRT_SECURE_NO_WARNINGS 1
//////#include<iostream>
//////using namespace std;
//////const int N = 1e5 + 10;
//////int h[N], e[N * 2], ne[N * 2], id;
//////int n;
//////bool st[N];//  标记当前结点是否已经被遍历过  
//////void add(int a, int b)
//////{
//////    id++;
//////    e[id] = b;//搞⼀个格子，存b
//////    //  把b头插在a这个链表的后⾯
//////    ne[id] = h[a];
//////    h[a] = id;
//////}
////////当前遍历到u这棵子树  
//////void dfs(int u)
//////{
//////    cout << u << " ";
//////    st[u] = true;
//////    for (int i = h[u]; i; i = ne[i])
//////    {
//////        int v = e[i];
//////        if (!st[v])
//////        {
//////            dfs(v);
//////        }
//////    }
//////}
//////int main()
//////{
//////    //⽤数组模拟链表
//////    cin >> n;
//////    for (int i = 1; i < n; i++)
//////    {
//////        int a, b; cin >> a >> b;
//////        add(a, b); add(b, a);
//////    }
//////    dfs(1);
//////    return 0;
//////}
////////#include<iostream>
////////#include<vector>
////////#include<queue>
////////using namespace std;
////////const int N = 1e5 + 10;
////////int n;
////////vector<int> edges[N];
////////bool st[N];
////////void bfs()
////////{
////////	queue<int>q;
////////	q.push(1);
////////	st[1] = true;
////////	while (q.size())
////////	{
////////		int u = q.front(); q.pop();
////////		cout << u << " ";
////////		for (auto v: edges[u])
////////		{
////////			if (!st[v])
////////			{
////////				q.push(v);
////////				st[v] = true;
////////			}
////////		}
////////	}
////////}
////////int main()
////////{
////////	cin >> n;
////////	for (int i = 1; i < n; i++)
////////	{
////////		int a, b; cin >> a >> b;
////////		edges[a].push_back(b);
////////		edges[b].push_back(a);
////////	}
////////	bfs();
////////	return 0;
////////}
//////////#define _CRT_SECURE_NO_WARNINGS 1
//////////#include<iostream>
//////////using namespace std;
//////////const int N = 1e5 + 10;
//////////int h[N], e[N], ne[N], id;
//////////int n;
//////////bool st[N];
//////////void add(int a, int b)
//////////{
//////////	id++;
//////////	e[id] = b;
//////////	ne[id] = h[a];
//////////	h[a] = id;
//////////}
//////////void dfs(int u)
//////////{
//////////	cout << u << " ";
//////////	st[u] = true;
//////////	for (int i = h[u]; i; i = ne[i])
//////////	{
//////////		int v = e[i];
//////////		if (!st[v])
//////////		{
//////////			dfs(v);
//////////		}
//////////	}
//////////}
//////////int main()
//////////{
//////////	cin >> n;
//////////	for (int i = 1; i < n; i++)
//////////	{
//////////		int a, b; cin >> a >> b;
//////////		add(a, b); add(b, a);
//////////	}
//////////	dfs(1);
//////////	return 0;
//////////}
//////////int n;
//////////vector<int> edge[N];
//////////bool st[N];
//////////void dfs(int u)
//////////{
//////////    cout << u << " ";
//////////    st[u] = true;
//////////    for (auto v : edge[u])
//////////    {
//////////        if (!st[v])
//////////        {
//////////            dfs(v);
//////////        }
//////////    }
//////////}
//////////int main()
//////////{
//////////    //建图
//////////    cin >> n;
//////////    for (int i = 1; i <= n; i++)
//////////    {
//////////        int a, b; cin >> a >> b;
//////////        edge[a].push_back(b);
//////////        edge[b].push_back(a);
//////////    }
//////////    //深度优先遍历
//////////    dfs(1);
//////////    return 0;
//////////}